package com.itlong.cloud.property;


import com.itlong.cloud.noncore.property.IPropertyOperatingReportServiceClient;
import com.itlong.cloud.paymenthub.IPropertyWithdrawServiceClient;
import org.slf4j.Logger;import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.RestController;

/**
 * <desc>
 *      物业自动提现定时任务
 * </desc>
 *
 * @createDate 2018/09/26
 */
@EnableScheduling // 启用定时任务
@RestController
public class PropertyAutoWithdrawTimedTask {
    private static Logger LOG = LoggerFactory.getLogger(PropertyAutoWithdrawTimedTask.class);

    @Autowired
    IPropertyWithdrawServiceClient iPropertyWithdrawServiceClient;

    /**
     * <desc>
     *      定时任务自动提现
     * </desc>
     *
     * @throws Exception
     * @author Qiang.S
     * @createDate 2018/09/26
     */
    @Scheduled(cron = "0 0 2 * * ?") // 每天凌晨2点执行
    public void doWithdraw() throws Exception {
        try {
            iPropertyWithdrawServiceClient.doAutoWithdraw();
//            LOG.info("【定时任务】定时任务自动提现成功");
        } catch (Exception e) {
            LOG.error("【定时任务】定时任务自动提现失败");
            throw e;
        }
    }
}
